﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MyTools.Pub;
using System.Collections;
using System.IO;
using System.Configuration;

namespace MyTools.DataDic
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            string path = ConfigurationManager.AppSettings["PDMPath"];
            string path1 = ConfigurationManager.AppSettings["PDMPath"];
            PDMReader reader = new PDMReader(path);
            List<TableInfo> list = reader.GetTableInfo();
            foreach (TableInfo t in list)
            {
                Hashtable ht = new Hashtable();
                ht.Add("T", t);
                StringWriter sw = FileGen.GetFileText(AppDomain.CurrentDomain.BaseDirectory + @"PDM文件解析\DataDic.vm", ht);
                StreamWriter sw1 = new StreamWriter(path1 + t.Code + ".sql", false, Encoding.UTF8);
                sw1.Write(sw.ToString());
                sw1.Close();
            }
        }
    }
}
